unit MarcaDM;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ZDataset, ZSqlUpdate, ZSequence, MainDM, QueryConditions, db;

type

  { TMarcaData }

  TMarcaData = class(TMainDataModule)
    MarcaDatasource: TDatasource;
    MarcaZQuery: TZQuery;
    MarcaZQuerydesc_marca: TStringField;
    MarcaZQueryid_marca: TLargeintField;
    MarcaZSequence: TZSequence;
    MarcaZUpdate: TZUpdateSQL;
    procedure DataModuleCreate(Sender: TObject);
    /// Abre o DataSet
    procedure OpenDataSet(); override;
    /// Fecha o DataSet
    procedure CloseDataSet(); override;
    /// Realiza busca
    /// @param(Condicoes são as condições para a busca)
    /// @param(Tabela é a tabela no banco de dados)
    procedure Search(Condicoes: TQueryConditions; Tabela: string); override;
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  MarcaData: TMarcaData;

implementation

uses ConnectionDM;

{ TMarcaData }

procedure TMarcaData.DataModuleCreate(Sender: TObject);
begin
    MainDataSet := MarcaZQuery;
    MarcaZQuery.Open;
end;

procedure TMarcaData.OpenDataSet;
begin
   // ConnectionData.EmptyQuery(MarcaZQuery, 'marca');
end;

procedure TMarcaData.CloseDataSet;
begin
   // MarcaZQuery.Close();
end;

procedure TMarcaData.Search(Condicoes: TQueryConditions; Tabela: string);
begin
    ConnectionData.OpenQueryConditions(MarcaZQuery, Tabela, Condicoes);
end;

initialization
  {$I marcadm.lrs}

end.

